const state = {
    flowStepStatus: -1, //跟进状态  flowStepArr: ['待跟进', '跟进中', '成交', '战败']
    purchaseStepStatus: -1, //线索意愿   purchaseStepArr: ['未知', '低', '中', '高']
    brandText: null, //品牌名称
    brandId: -1, //品牌id
    modelText: null, //车型名称
    modelId: -1, //车型id
    clueType: -1, //线索类型
    insureStartDate: null, //保险到期开始时间
    insureEndDate: null, //保险到期结束时间
    isSearch: false //是否查询
}

const mutations = {
    SET_SEARCHINFO: (state, info) => {
        state.flowStepStatus = info.flowStepStatus; //跟进状态  flowStepArr: ['待跟进', '跟进中', '成交', '战败']
        state.purchaseStepStatus = info.purchaseStepStatus; //线索意愿   purchaseStepArr: ['未知', '低', '中', '高']
        state.brandText = info.brandText; //品牌名称
        state.brandId = info.brandId; //品牌id
        state.modelText = info.modelText; //车型名称
        state.modelId = info.modelId; //车型id
        state.insureStartDate = info.insureStartDate; //保险到期开始时间
        state.insureEndDate = info.insureEndDate; //保险到期结束时间
        state.isSearch = info.isSearch; //是否查询
        state.clueType = info.clueType; //线索类型
    },
    CLEAR_SEARCHINFO: (state) => {
        state.flowStepStatus = -1; //跟进状态  flowStepArr: ['待跟进', '跟进中', '成交', '战败']
        state.purchaseStepStatus = -1; //线索意愿   purchaseStepArr: ['未知', '低', '中', '高']
        state.brandText = null; //品牌名称
        state.brandId = -1; //品牌id
        state.modelText = null; //车型名称
        state.modelId = -1; //车型id
        state.insureStartDate = null; //保险到期开始时间
        state.insureEndDate = null; //保险到期结束时间
        state.isSearch = false; //是否查询
        state.clueType = -1; //线索类型
    }
}

const actions = {

    searchInfo({
        commit
    }, info) {
        return new Promise(resolve => {
            commit('SET_SEARCHINFO', info);
            resolve()
        })
    },
    clearSearchInfo({
        commit
    }) {
        return new Promise(resolve => {
            commit('CLEAR_SEARCHINFO');
            resolve()
        })
    }
}

export default {
    namespaced: true,
    state,
    mutations,
    actions
}
